class Solution {
public:
	vector<vector<int>> result;
	vector<int> path;
	void backtracking(vector<int> &nums,bool used[]){
		if(path.size() == nums.size()){
			result.push_back(path);
			return ;
		}
		for(int i = 0 ; i < nums.size() ; i++){
			if(!used[i]){
				used[i] = true;
				path.push_back(nums[i]);
				backtracking(nums,used);
				used[i] = false;
				path.pop_back();
			}
		}
	}
	vector<vector<int>> permute(vector<int>& nums) {
		const int N = 10;
		bool used[N];
		backtracking(nums,used);
		return result;
	}
};
